<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/head.jsp"%>
<html>
<head>
	<title>投资管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
	    	return false;
	    }
		
		//全选
		$(function(){
			$("#checkAll").click(function(){
	 			$(":input[type='checkbox'][name='pid']").each(function(){
	 				$(this).prop("checked",$("#checkAll").prop("checked"));
	 			});
	 		});
		});

		//验证是否选择
		function confirm(){
			var ids="";
			$(":input[type='checkbox'][name='pid']:checked").each(function(){
				if(ids!=""){
					ids=ids+","+$(this).val();
				}else ids=$(this).val();		
			});
			if(ids==""){
				alert("请选择要删除的信息!");
				return;
			}else{
				return confirmx('确认要删除吗？', this.href='{index}/invest/delete?id='+ids);
			}
		}
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="{index}/index/invest">投资列表</a></li>
		<li>
			<li><a href="{index}/invest/form">投资购买</a></li>
		</li>
	</ul>
	<form:form id="searchForm" modelAttribute="invest" action="${index}/invest" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${pageSize}"/>
		<label>投资编号：</label><form:input path="investNo" htmlEscape="false" maxlength="50" class="input-small"/>&nbsp;&nbsp;
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
		<a href="javascript:;" class="btn btn-primary" onclick="confirm();">删除</a>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
		  <tr>
		  	  <th><input type="checkbox" id="checkAll"/></th> 
		      <th>投资编号</th>
		      <th>待结算金额</th>
		      <th>创建时间</th>
		      <th>操作</th>

		  </tr>
		</thead>
		<tbody>
		<c:forEach items="${investList}" var="invest">
			<tr>
				<td><input type="checkbox" name="pid" value="${invest.id}"/></td>
				<td><a href="javascript:" onclick="$('#name').val('${invest.name}');$('#searchForm').submit();return false;">${invest.name}</a></td>
				<td>${invest.description}</td>
				<td>
				    <fmt:formatDate value="${invest.productDate}" type="date"/>
				</td>
				<td>
	    			<a href="${ctx}/index/invest/form?id=${invest.id}">修改</a>
					<a href="${ctx}/index/invest/delete?id=${invest.id}" onclick="return confirmx('确认要删除吗？', this.href)">删除</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<tags:pagination paginationSize="10" page="${investList}"></tags:pagination>
</body>
</html>